package com.bfxy.rabbitmq.ack;

import com.bfxy.rabbitmq.util.RabbitUtil;
import com.rabbitmq.client.Channel;

/**
 * Created by deng_wb on 2020/3/14
 */
@SuppressWarnings("all")
public class Consumer {

    public static void main(String[] args)throws Exception {

        Channel channel = RabbitUtil.consumerChannel();

        String exchangeName = "test_ack_exchange";
        String routingKey = "ack.#";
        String queueName = "test_ack_queue";

        channel.exchangeDeclare(exchangeName,"topic",true,false,null );
        channel.queueDeclare(queueName,true,false,false,null);
        channel.queueBind(queueName,exchangeName,routingKey);


        // 手工签收 autoAck=false
        channel.basicConsume(queueName,false,new MyConsumer(channel));

    }
}
